<template>
  <view class="my-search-container" :style="{'background-color': bgcolor}">
    <view class="my-search-box" :style="{'border-radius': radius + 'px'}" @click="searchBox">
      <!-- uni的自带图标 -->
      <uni-icons type="search" size="30"></uni-icons>
      <text class="placeholder">搜索</text>
    </view>

  </view>
</template>
<script>
  export default {
    props: {
      // 背景颜色
      bgcolor: {
        type: String,
        default: '#C00000'
      },
      // 圆角尺寸
      radius: {
        type: Number,
        // 单位是 px
        default: 18
      }
    },

    data() {
      return {

      }
    },

    methods: {
      searchBox() {
        // console.log('------')

        // 触发外界通过 @click 绑定的 click 事件处理函数
        this.$emit('click')
      }
    }


  }
</script>
<style>
  .my-search-container {
    height: 50px;
    align-items: center;
    display: flex;
    padding: 0 10px;
    /* background-color: aqua; */
  }

  .my-search-box {
    height: 36px;
    width: 100%;
    background-color: #ffffff;
    display: flex;
    /* border-radius: 18px; */
    justify-content: center;
    align-items: center;
  }

  .placeholder {
    font-size: 15px;
    margin-left: 5px;
  }
</style>
